package routers

import (
	"github.com/gin-gonic/gin"
	"roomAdmin/middleware"
	"roomAdmin/routers/applyRouter"
	"roomAdmin/routers/authRouter"
	"roomAdmin/routers/roomRouter"
	"roomAdmin/routers/userRouter"
)

func InitRouter() (r *gin.Engine) {

	// 自定义logger中间件
	r = gin.New()
	r.Use(middleware.Logger())
	r.Use(gin.Recovery())
	r.Use(middleware.Cors())


	v1 := r.Group("/api/v1")
	{
		authRouter.Login(v1)
		userRouter.StudentRouter(v1)
		userRouter.AdminRouter(v1)
		roomRouter.RoomRouter(v1)
		userRouter.AdminRouter(v1)
		applyRouter.RepairApplyRouter(v1)
		applyRouter.UseApplyRouter(v1)
	}
	return r
}
